package com.example.leetcode;

import java.util.Random;

public class Test1 {
    public static void main(String[] args) {
        Random random = new Random();
        long t1 = System.currentTimeMillis();
        for (int i = 0; i < 10_0000_0000; i++) {
            neg1(random.nextInt());
        }
        long t2 = System.currentTimeMillis();
        System.out.println("时间是：" + (t2 - t1));
        for (int i = 0; i < 10_0000_0000; i++) {
            neg2(random.nextInt());
        }
        long t3 = System.currentTimeMillis();
        System.out.println("时间是：" + (t3 - t2));
    }

    private static boolean neg1(int i) {
        return (i >>> 31 & 1) == 1;
    }

    private static boolean neg2(int i) {
        return i < 0;
    }
}
